package com.example.demo.controller.requests;

import com.example.demo.model.Student;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.servlet.ModelAndView;

import java.time.LocalDate;

@Controller
public class RouterController {
    @GetMapping("/")
    public  String Index(){
        return  "manage/login";
    }
    @GetMapping("manage/index")
    public String adminIndex(){
        return  "manage/welcome";
}
@GetMapping("/menu/stu")
    public  String stuIndex(){
        return "/drink/index";
}
@GetMapping("/drink/addform")
    public  String stuAddform(){
        return  "/drink/add";
}
@GetMapping("/drink/updateform")
    public ModelAndView stuUudateForm(@RequestParam Integer id){
        ModelAndView mv = new ModelAndView("/drink/edit");
        Student build = Student.builder().id(13).name("YY").adminssionDate(LocalDate.parse("2000-5-30")).major("移动应用开发").build();
        mv.addObject("data",build);
        return  mv;
}
    }
